package cn.webrx;

import cn.webrx.service.HelloMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.Banner;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * <p>功能描述: </p>
 *
 * @author webrx
 * @version 1.0
 * @date 2020-06-01 18:59
 */

@SpringBootApplication
public class App implements CommandLineRunner {
    @Autowired
    private HelloMessageService hs;

    public static void main(String[] args) throws Exception {
        //disabled banner, don't want to see the spring logo
        SpringApplication app = new SpringApplication(App.class);
        app.setBannerMode(Banner.Mode.OFF);
        app.run(args);
    }
    // Put your logic here.
    @Override
    public void run(String... args) throws Exception {
        if (args.length > 0) {
            System.out.println(hs.getMessage(args[0].toString()));
        } else {
            System.out.println(hs.getMessage());
        }
        System.out.println(hs.getMessage("hello123"));
        System.exit(0);
    }
}
